//	ID : pallab81
// 	PROG : 836
// 	LANG : C++
// 	2011-08-28-20.00.29 Sunday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define fo(i,ed) for(int i = 0 ; i < ed ; ++i )
#define foR(i,st,ed) for(int i = st ; i < ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait( double seconds ) {
    double endtime = clock()+( seconds* CLOCKS_PER_SEC );
    while( clock() < endtime ) {
        ;
    }
}
vector< string > g;
vector< VI > v;
string feed;
inline void Read() {
    g.clear();
    string line;
    while( getline(cin,line) ) {
        if( LN(line)<1 )break;
        g.pb( line );
    }
}
inline void P() {
    int R = SZ(g);
    int C = LN(g[0]);
    for(int r=0; r<R; ++r) {
        for(int c=0; c<C; ++c) {
            printf("%3d",v[r][c]);
        }
        printf("\n");
    }
}
inline void Proc() {
    int R = SZ(g);
    int C = LN(g[0]);
    v.assign(R,VI(C,0));

    for(int r=0; r<R; ++r) {
        int d=0;
        for(int c=0; c<C; ++c) {
            d = ( g[r][c]=='1' ? d+1 : 0 ) ;
            v[r][c] = d;
        }
    }
    int mx=0;
    for(int r=0; r<R; ++r) {
        for(int c=0; c<C; ++c) {
            int left_ = v[r][c];
            // printf("NOW ROW,COL %d %d\n",r,c);
            for(int k=r,up_=1; k>=0; --k,++up_) {
                left_ = min(left_, v[k][c]);
                // printf("%d %d\n",left_,up_);
                // wait(.5);
                int area = left_*up_;
                if( area > mx ) {
                    mx = area;
                }
            }
        }
        // printf("\nDONE\n\n");
    }
    printf("%s%d\n",feed.c_str(),mx);
    feed="\n";
}

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("in.txt","rt",stdin);
//#endif

    int cases=1;
    feed="";
    for( CI(cases),scanf("\n") ; cases ; --cases ) {
        Read();
        Proc();
    }

    return 0;
}
